    
<?
//display section in functie de id (daca acesta este 0 atunci se adauga):
function display_sect($id)
{
	if ($id==0)
	{
	?>

			<FORM action="" name="test2" method="post"> 

			<table width="90%">
			<tr><td width="100px">Name</td><td><input name="name" type="text" value="" style="width:200px" /></td></tr>
			<tr><td>Description</td><td><INPUT name="description" type="text" value="" style="width:200px" /></td></tr>

			<tr><td>Start date</td><td><INPUT TYPE="text" NAME="start_date" VALUE="" style="width:170px" /> 
			<A HREF="#" onClick="cal.select(document.forms['test2'].start_date,'anchor3','yyyy-MM-dd'); return false;"
			NAME="anchor3" ID="anchor3"><img src="images/calendar.jpg"></A> </td></tr>

			<tr><td>Stop date</td><td><input name="stop_date" type="text" value="" style="width:170px"/>
			<A HREF="#" onClick="cal.select(document.forms['test2'].stop_date,'anchor4','yyyy-MM-dd'); return false;"
			NAME="anchor4" ID="anchor4"><img src="images/calendar.jpg"></A> </td></tr>

			<!-- <tr><td>User</td><td><input name="user" type="text" value="" style="width:98%" /></td></tr>
			<tr><td>Data editare</td><td><input name="edit_date" type="text" value="" style="width:98%" /></td></tr> -->
			<tr><td><input type="submit" name="qr_add" value="Add"></td>
			<td align="right"><input type="submit" name="qr_cancel" value="Cancel"></td></tr>
			</table>
			</FORM> 
				
	<?
	}
	else
	{
				//poate reusim sa facem transfer de variabile ca sa nu stresam db'ul...
				$result = returnQuery("select * from projects where id = ".$id.";",'');
				$row = mysql_fetch_assoc($result);
				?>
				<form action="" name="test3" method="post">
				<table width="90%">
			<tr>
				<td>Name</td>
				<td align="right" colspan="2"><input name="name" type="text" value="<? echo $row['name'] ?>" style="width:200px" ></td>    
				</tr>
			<tr>
				<td>Description</td>
				<td align="right" colspan="2"><input name="description" type="text" value="<? echo $row['description'] ?>" style="width:200px"></td>
				</tr>
			<tr>
				<td>Start date</td>
				<td align="right" colspan="2"><input name="start_date" type="text" value="<? echo $row['start_date'] ?>" size =25>
			<A HREF="#" onClick="cal.select(document.forms['test3'].start_date,'anchor1','yyyy-MM-dd'); return false;"
			NAME="anchor1" ID="anchor1"><img src="images/calendar.jpg"></A></td>
				</tr>
			<tr>
				<td>Stop date</td>
				<td align="right" colspan="2"><input name="stop_date" type="text" value="<? echo $row['stop_date'] ?>" size = 25> <A HREF="#" onClick="cal.select(document.forms['test3'].stop_date,'anchor2','yyyy-MM-dd'); return false;"
			NAME="anchor2" ID="anchor2"><img src="images/calendar.jpg"></A></td>
				</tr>
			<!-- <tr>
				<td>Data editare</td>
				<td align="right" colspan="2"><input name="edit_date" type="text" value="<? echo $row['edit_date'] ?>" style="width:98%"></td>
				</tr> -->
				
			<tr>
				<td><input type="submit" name="qr_update" value="Update"></td>
			<td><input type="submit" name="qr_del" value="Delete"></td>
			<td><input type="submit" name="qr_cancel" value="Cancel"></td>
				</tr>
			</table>
	
	<?
	}
}

	function refreshPage($destination)
	{
		print "<meta http-equiv=\"refresh\" content=\"0; url=".$destination."\">";
	 
	}


?>